package cn.shengchao.rule.condition.valueType;

import cn.hutool.core.collection.CollUtil;
import cn.hutool.core.util.StrUtil;
import cn.shengchao.rule.condition.matchType.IMatchType;

import java.util.*;

/**
 * @program: examstarapi
 * @description: 日期天数类型
 * @author: Xiong weiqiang
 * @create: 2025-04-11 14:39
 */
public class ArrayValueType implements IValueType{
    @Override
    public List<String> getAvailableMatchTypes() {
        return List.of(IMatchType.IN_ARRAY
        );
    }

    @Override
    public String valueTypeKey() {
        return IValueType.TYPE_ARRAY;
    }

    @Override
    public String valueTypeName() {
        return "数组";
    }

    public static String parseListToValue(List<String> stringList){
        return CollUtil.isNotEmpty(stringList)?String.join(",",stringList):"";
    }

    public static List<String> parseValueToList(String arrayStr){
        return StrUtil.isBlank(arrayStr)? new ArrayList<>() :Arrays.asList(arrayStr.split(","));
    }
}